package pip.can;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.border.EtchedBorder;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

public class ResultGraph extends JFrame {

	private JPanel contentPane;
	public static void main(String[] args) {
		ResultGraph gr = new ResultGraph();
	}


	/**
	 * Create the frame.
	 */
	public ResultGraph() {
		setTitle("Wyniki");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 555, 399);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		panel.setLayout(new BorderLayout());
		panel.setBounds(12, 12, 529, 345);
		contentPane.add(panel);
		
		XYSeries points = new XYSeries("Kod");
		points.clear();
		for (int q=1;q<=StaticVariables.Classes;q++){
		points.add(q-1, StaticVariables.Results[q-1]);
		}
		//System.out.println("Poisson " + (double)Distribution.poissonRandNum(100)/100.0);
        XYSeriesCollection xySeriesCollection = new XYSeriesCollection(points);
        XYDataset xyDataset = xySeriesCollection;
        JFreeChart chart = ChartFactory.createXYLineChart ("", "Class k", "Delivery Time [s]", xyDataset, PlotOrientation.VERTICAL, false, true, false);
        ChartPanel chartFieldPanel1 = new ChartPanel(chart);
		panel.add(chartFieldPanel1);
		
		
		setVisible(true);
	}
}
